@echo off
chcp 65001 >nul
echo ========================================
echo 创建支付宝配置环境文件
echo ========================================
echo.

set /p NGROK_URL="请输入你的ngrok地址（例如：abc123.ngrok-free.dev）: "

if "%NGROK_URL%"=="" (
    echo 错误：未输入地址
    pause
    exit /b 1
)

echo.
echo 正在创建 .env 文件...

(
echo # 支付宝配置
echo ALIPAY_APP_ID=9021000157661754
echo ALIPAY_NOTIFY_URL=https://%NGROK_URL%/api/payment/alipay/notify
echo ALIPAY_RETURN_URL=https://%NGROK_URL%/api/payment/alipay/return
echo ALIPAY_DEBUG=True
echo.
echo # 数据库配置
echo MYSQL_HOST=localhost
echo MYSQL_PORT=3306
echo MYSQL_USER=root
echo MYSQL_PASSWORD=123456
echo MYSQL_DATABASE=xiang
echo.
echo # Redis配置
echo REDIS_HOST=localhost
echo REDIS_PORT=6379
echo REDIS_DB=0
echo.
echo # JWT配置
echo JWT_SECRET_KEY=your-secret-key-change-in-production
) > .env

echo.
echo ✅ .env 文件已创建！
echo.
echo 配置内容：
echo   ALIPAY_NOTIFY_URL=https://%NGROK_URL%/api/payment/alipay/notify
echo   ALIPAY_RETURN_URL=https://%NGROK_URL%/api/payment/alipay/return
echo.
echo 下一步：重启后端服务以加载新配置
echo.
pause

